// GUI.h

#include "stdafx.h"
// #include "BaseApplication.h"
 
#include <OISEvents.h>
#include <OISInputManager.h>
#include <OISKeyboard.h>
#include <OISMouse.h>
#include <OgreFrameListener.h>
#include <string>
#include <CEGUI/CEGUI.h>
#include <CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h>
 
#ifndef __GUI_h_
#define __GUI_h_

using namespace std;

class GUI {
public:
	/**
	* The constructor, which will gall the initializeGUI method
	*/
	GUI(void);

	/**
	* The deconstructor. This does nothing now!
	*/
	~GUI(void);

	/**
	* Sets the GUI sheet (layout) to be used. CONSIDER ADDING THIS TO INITIALIZE AND PASSING LAYOUTNAME THROUGH THAT INSTEAD
	*/
	void setGUIsheet(string layoutName);

	/**
	* Injects timestamps into CEGUI system so that it can be updated
	*/
	void updateGUI(const Ogre::FrameEvent& evt);

	/**
	* Inject key event for keyboard key pressed into the CEGUI system, in order to catch keypresses
	*/
	void keyDownGUI(const OIS::KeyEvent &arg);

	/**
	* Inject key event for keyboard key released into the CEGUI system, in order to catch when keys are released
	*/
	void keyUpGUI(const OIS::KeyEvent &arg);

	/**
	* Inject mouse moved events into the CEGUI system, so mouse cursor in menus etc can be updated
	*/
	void mouseMovedGUI(const OIS::MouseEvent &arg);

	/**
	* Inject mouse button down events into the CEGUI system, so mouse clicks can be registered
	*/
	void mouseDownGUI(const OIS::MouseButtonID id);

	/**
	* Inject mouse button up events into the CEGUI system, so mouse clicks can be registered
	*/
	void mouseUpGUI(const OIS::MouseButtonID id);

	
	
protected:
	CEGUI::OgreRenderer* mRenderer;

	/**
	* @Brief Does the necessary steps to initialize the GUI
	*
	* Bootstraps the CEGUI system, set the default resource groups for the CEGUI resource managers
	* selects the skin and sets the mouse cursor
	*/
	void initializeCEGUI();


	/**
	* @brief Converts from OIS mouse button IDs to CEGUI mouse button IDs
	*
	* OIS::MB_Left = CEGUI::LeftButton
	* OIS::MB_Right = CEGUI::RightButton
	* OIS::MB_Middle = CEGUI::MiddleButton
	* Per default left button click is returned
	*/
    CEGUI::MouseButton convertButton(OIS::MouseButtonID buttonID);

};
#endif